home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_05
/
1005092b
< prev
next >
Wrap
Text File
|
1992-03-07
|
381b
|
24 lines
Listing 5
class rational
{
public:
rational() : num(0), denom(1) { }
...
long rational::numerator() { return num; }
long rational::denominator() { return denom; }
private:
long num, denom;
void simplify();
};
...
ostream &operator<<(ostream &os, rational r)
{
os << '(' << r.numerator() << '/'
<< r.denominator() << ')';
}